#!/usr/bin/env node

let count = 1,timer1,timer2;

timer1 = setInterval(()=>{
  console.log('#1 I will loop forever');  
},500);

setTimeout(()=>{
  clearInterval(timer1);
  timer2 = setInterval(()=>{
    console.log('#2 I will loop forever');
    if(count++ >= 5){
      count = 0;
      global.clearInterval(timer2);
    }
  },500)
},5000)
